package com.richrail.model;

import com.richrail.model.entities.Wagon;

public class WagonFactory
{
	private NameGenerator nameGen;
	
	public WagonFactory(NameGenerator nameGen)
	{
		this.nameGen = nameGen;
	}
	
	public Wagon create(String name)
	{
		return create(name, 20);
	}
	
	public Wagon create(String name, int seatCount)
	{
		if (name == null) name = nameGen.generateName();
		return new Wagon(name, seatCount);
	}
}
